package com.gz.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.gz.jsonbean.MyOrder;
import com.gz.jsonbean.MyOrders;

public class OrderUtil {
	public static String getWxPayUrl(String retStr){
		String retTempStr = "";
		String reg = "{\"TenPayUrl\":\"(.*?)\",\"Money\":\"";
	    Pattern pattern = Pattern.compile(reg);
	    Matcher matcher = pattern.matcher(retStr);
	    while(matcher.find()){
	    	retTempStr = matcher.group(1);
        }
	    return retTempStr;
	}
	public static MyOrder getOrderNo(MyOrders myOrders,String orderId){
		if(myOrders.getOrders()!=null && myOrders.getOrders().size()>0) {
			for(MyOrder myOrder : myOrders.getOrders()) {
				if(myOrder.getOrderID().equals(orderId)) {
					return myOrder;
				}
			}
		}
		return null;
	}
}
